unit ReportCtrl;

interface
uses
  SysUtils, forms, buttons, classes, controls, patterns;

type
  TControllerReport = class(TController)
  private
  protected
    procedure DoCommand(Command: string; const args: string=''); override;
  public
  end;

implementation
uses commandlist, Pickrep;

procedure TControllerReport.DoCommand(Command: string; const args: string='');
var
  param: string;
begin
  if command = CMD_BTN_REPORT then
  begin
    with TPickRpt.Create(nil) do
    begin
      if ShowModal = mrOK then
      begin
        if preview then
          param := 'preview'
        else
          param := 'print';
        case ReportType.ItemIndex of
          0: self.SendCommand(CMD_RPT_CUSTOMER, param); //PrintCustomerReport(Preview);
          1: self.SendCommand(CMD_RPT_ORDER, param); //PrintOrderReport(Preview);
          2: self.SendCommand(CMD_RPT_INVOICE, param); //PrintInvoiceReport(Preview);
        end;
        free;
      end;
    end;
  end;
end;

initialization
  ControlCenter.RegController(TControllerReport.Create);

end.

